import os
from urllib.request import urlopen

# .代表当前目录位置
filenames = os.listdir('')
print(filenames)
# endswith表示以什么结尾的
my_end= [name for name in filenames if name.endswith('.py')]
print(my_end)



def read_data(name):
    if name.startswith(('http:', 'https:', 'ftp:')):
        return urlopen(name).read()
    else:
        with open(name) as f:
            return f.read()

choices = ['http:','ftp:']
url = "http:www.baidu.com"
print(url.startswith(tuple(choices)))
